package com.piggy.sys.api;

import com.piggy.common.core.constant.SecurityConstants;
import com.piggy.common.core.constant.ServiceNameConstants;
import com.piggy.common.core.domain.R;
import com.piggy.common.core.utils.sms.SmsConfig;
import com.piggy.common.core.web.page.TableDataInfo;
import com.piggy.sys.api.bo.SmsNotify;
import com.piggy.sys.api.bo.SysEmailBo;
import com.piggy.sys.api.bo.SysSmsBo;
import com.piggy.sys.api.bo.SysSmsQueryBo;
import com.piggy.sys.api.factory.RemoteSmsFallbackFactory;
import com.piggy.sys.api.vo.SysSmsVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 用户服务
 *
 * @author shark
 */
@FeignClient(contextId = "remoteSmsService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteSmsFallbackFactory.class)
public interface RemoteSmsService {

    @GetMapping("/sysSms/userRegSendSms/{phone}")
    public R<Boolean> userRegSendSms(@PathVariable("phone") String phone, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("/sysSms/createAccount/{phone}")
    public R<Boolean> createAccount(@PathVariable("phone")String phone, @RequestParam("passwd")String passwd, @RequestParam("company")String company, @RequestParam("regTime")String regTime, @RequestHeader(SecurityConstants.FROM_SOURCE)String source);

    @GetMapping("/sysSms/resetPasswd/{phone}")
    public R<Boolean> resetPasswd(@PathVariable("phone") String phone, @RequestParam("password") String password, @RequestParam("company") String company, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("/sysSms/waybillNotify/{phone}")
    public R<Boolean> waybillNotify(@PathVariable("phone") String phone, @RequestParam("waybillNo") String waybillNo, @RequestParam("status") String status, @RequestParam("nextStatus") String nextStatus, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("/sysSms/scheduleNotify/{phone}")
    public R<Boolean> scheduleNotify(@PathVariable("phone") String phone, @RequestParam("scheduleNo") String scheduleNo, @RequestParam("status") String status, @RequestParam("nextStatus") String nextStatus, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @PostMapping("/sysSms/smsNotify/{phone}")
    public R<Boolean> smsNotify(@PathVariable("phone") String phone, @RequestBody SmsNotify smsNotify, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 获取注册用户手机验证码
     *
     * @return
     */
    @GetMapping("/sysSms/getConfig")
    public R<SmsConfig> getConfig(@RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @PostMapping("/sysSms/sendMail")
    public R<Boolean> sendMail(@RequestBody SysEmailBo emailBo, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @PostMapping("/sysSms/sendSms")
    public R<Boolean> sendSms(@RequestBody SysSmsBo bo, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 查询消息列表
     */
    @GetMapping("/sysSms/list")
    public TableDataInfo<SysSmsVo> list(@Validated SysSmsQueryBo bo, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

}
